/*
 * Copyright 2020 tu.cn All right reserved. This software is the
 * confidential and proprietary information of tu.cn ("Confidential
 * Information"). You shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license agreement you entered
 * into with Tu.cn
 */
package cn.zjitc.service.impl;

import cn.zjitc.dao.ProductDao;
import cn.zjitc.dao.impl.ProductDaoImpl;
import cn.zjitc.domian.Product;
import cn.zjitc.service.ProductService;

import java.util.List;

/**
 * @author dell
 * @date 2020/7/3 8:40
 */
public class ProductServiceImpl implements ProductService {
    private ProductDao productDao = new ProductDaoImpl();
    @Override
    public List<Product> findAll() {
        return productDao.findAll();
    }

    @Override
    public void addProduct(Product product) {
        productDao.addProduct(product);
    }

    @Override
    public Product fingProductByName(String name) {
        return productDao.findByName(name);
    }

    @Override
    public void delProduct(String id) {
        productDao.delProduct(Integer.parseInt(id));
    }

    @Override
    public Product findProductById(String id) {
        return productDao.findById(Integer.parseInt(id));
    }

    @Override
    public void update(Product product) {
        productDao.update(product);
    }
}
